/* 文件管理页面样式 */

/* 页面头部 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.back-btn {
    background: linear-gradient(135deg, #2979ff, #1565c0);
    color: #fff;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: linear-gradient(135deg, #1565c0, #0d47a1);
    transform: translateY(-1px);
}

/* 文件列表和编辑器布局 */
.files-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    background: #262626;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #333;
}

/* 文件列表 */
.file-list {
    border-right: 1px solid #333;
    padding-right: 20px;
}

.file-item {
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a1a1a;
    border: 1px solid #333;
    transition: all 0.3s ease;
}

.file-item:hover {
    background: #2c2c2c;
    transform: translateY(-1px);
}

.file-item.active {
    background: #1e3a5f;
    border-color: #64b5f6;
}

.file-item.main-file {
    font-weight: 500;
    color: #64b5f6;
}

.main-badge {
    background: rgba(100, 181, 246, 0.2);
    color: #64b5f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* 编辑器区域 */
.editor-container {
    display: none;
}

.editor-container.active {
    display: block;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.editor-header h3 {
    color: #e0e0e0;
    margin: 0;
    font-size: 16px;
}

.editor-actions {
    display: flex;
    gap: 10px;
}

.save-btn, .set-main-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.save-btn {
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
    color: white;
}

.save-btn:hover {
    background: linear-gradient(135deg, #1b5e20, #003300);
    transform: translateY(-1px);
}

.set-main-btn {
    background: linear-gradient(135deg, #1976d2, #0d47a1);
    color: white;
}

.set-main-btn:hover {
    background: linear-gradient(135deg, #0d47a1, #002171);
    transform: translateY(-1px);
}

.editor {
    width: 100%;
    height: 500px;
    font-family: 'Consolas', monospace;
    padding: 15px;
    background: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #333;
    border-radius: 6px;
    resize: vertical;
    line-height: 1.5;
    font-size: 14px;
}

.editor:focus {
    outline: none;
    border-color: #64b5f6;
    box-shadow: 0 0 0 2px rgba(100, 181, 246, 0.2);
}

/* 状态消息 */
.status-message {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    background: #333;
    color: #fff;
    font-size: 14px;
    display: none;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .files-container {
        grid-template-columns: 1fr;
    }

    .file-list {
        border-right: none;
        border-bottom: 1px solid #333;
        padding-right: 0;
        padding-bottom: 20px;
        margin-bottom: 20px;
    }
}

/* 屏幕阅读器专用样式 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 文件树样式 */
.file-tree {
    border-right: 1px solid #333;
    padding-right: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.tree-directory {
    margin: 2px 0;
}

.directory-header {
    display: flex;
    align-items: center;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    background: #1a1a1a;
    border: 1px solid #333;
}

.directory-header:hover {
    background: #2c2c2c;
    transform: translateY(-1px);
}

.directory-toggle {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    position: relative;
    transition: transform 0.3s ease;
}

.directory-toggle::before {
    content: '';
    position: absolute;
    top: 7px;
    left: 2px;
    width: 8px;
    height: 2px;
    background-color: #64b5f6;
}

.directory-toggle::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 5px;
    width: 2px;
    height: 8px;
    background-color: #64b5f6;
    transition: transform 0.3s ease;
}

.tree-directory.expanded > .directory-header .directory-toggle::after {
    transform: scaleY(0);
}

.directory-name {
    color: #64b5f6;
    font-weight: 500;
}

.directory-content {
    display: none;
    padding-left: 24px;
    margin-top: 2px;
}

.tree-directory.expanded > .directory-content {
    display: block;
}

.tree-file {
    display: flex;
    align-items: center;
    padding: 8px;
    margin: 2px 0;
    cursor: pointer;
    border-radius: 6px;
    background: #1a1a1a;
    border: 1px solid #333;
    transition: all 0.3s ease;
}

.tree-file:hover {
    background: #2c2c2c;
    transform: translateY(-1px);
}

.tree-file.active {
    background: #1e3a5f;
    border-color: #64b5f6;
}

.file-icon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    position: relative;
}

.file-icon::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 0;
    width: 12px;
    height: 14px;
    border: 1px solid #757575;
    border-radius: 2px;
}

.python-file::before {
    border-color: #64b5f6;
}

.python-file::after {
    content: 'py';
    position: absolute;
    top: 4px;
    left: 2px;
    font-size: 8px;
    color: #64b5f6;
}

.file-name {
    flex: 1;
    color: #e0e0e0;
}

.main-file .file-name {
    color: #64b5f6;
}

/* 滚动条样式 */
.file-tree::-webkit-scrollbar {
    width: 8px;
}

.file-tree::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.file-tree::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

.file-tree::-webkit-scrollbar-thumb:hover {
    background: #444;
} 